﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Web.Caching;

namespace LiteFramework
{
    public interface ICache
    {
        /// <summary>
        /// 是否已过期。true已过期
        /// </summary>
        bool IsExpired { get; }
        /// <summary>
        /// 过期时间
        /// </summary>
        DateTime ExpiryTime { get; set; }
        /// <summary>
        /// 重置过期时间
        /// </summary>
        /// <param name="second">x秒后过期。小于0代表永不过期</param>
        void ResetExpiryTime(int second);
    }
    public interface ICacheContainer<T> where T : ICache
    {
        event Func<string, T> retrieveFun;
        void Add(string key, T value);
        T Get(string key);
        void Remove(string key);
        void Clear();
    }
}